<template>
  <div class="header">
    <el-menu
      :default-active="activeIndex"
      class="header_menu"
      mode="horizontal"
      @select="handleSelect"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="1">处理中心</el-menu-item>
      <el-submenu index="2">
        <template slot="title">我的工作台</template>
        <el-menu-item index="2-1">选项1</el-menu-item>
        <el-menu-item index="2-2">选项2</el-menu-item>
        <el-menu-item index="2-3">选项3</el-menu-item>
        <el-submenu index="2-4">
          <template slot="title">选项4</template>
          <el-menu-item index="2-4-1">选项1</el-menu-item>
          <el-menu-item index="2-4-2">选项2</el-menu-item>
          <el-menu-item index="2-4-3">选项3</el-menu-item>
        </el-submenu>
      </el-submenu>
    </el-menu>

    <div class="logininfo">
      <el-menu
        active-text-color="#ffd04b"
        mode="horizontal"
        class="header_menu"
      >
        <el-submenu index="1">
          <template slot="title">{{
            loginUser == null ? "" : loginUser.userName
          }}</template>
          <el-menu-item index="1">个人信息</el-menu-item>
          <el-menu-item index="2">退出</el-menu-item>
        </el-submenu>
      </el-menu>
    </div>
  </div>
</template>

<script>
import { storeExtend } from "../store";
export default {
  name: "ht-ms-header",
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    }
  },
  computed: {
    logoStyle() {
      return {
        "background-image": `url(${this.logo_url})`
      };
    }
  },
  data() {
    return {
      activeIndex: "1",
      logo_url: require("@/assets/logo.png"),
      loginUser: storeExtend.state.loginUser
    };
  }
};
</script>

<style lang="scss">
.header {
  height: 50px;
  display: flex;
  border-bottom: solid 0.01852rem #e6e6e6;
  flex-direction: row;
  .logo {
    height: 100%;
    text-align: center;
    width: 150px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    transition: 0.5s all;
    &:hover {
      background-color: #ececec;
      cursor: pointer;
    }
    margin-right: 50px;
  }
  .header_menu {
    height: 50px;
    flex: 1;
    border-bottom: none;
    padding-left: 10px;
    li {
      height: 50px;
      line-height: 50px;
      .el-submenu__title {
        height: 100%;
        line-height: 50px;
      }
    }
  }
  .logininfo {
    border-bottom: none;
    text-align: right;
    width: 135px;
    line-height: 50px;
    color: #ffd04b;
  }
}
</style>
